package shuashuami.hb.test;

/**
 * <b>类   名：</b>${TYPE_NAME} <br/>
 * <b>类描述：</b> <br/>
 * <b>创建人：</b>zhangqi<br/>
 * <b>创建时间：</b>2017/6/23<br/>
 * <b>修改人：</b>zhangqi<br/>
 * <b>修改时间：</b>2017/6/23<br/>
 * <b>修改备注：</b><br/>
 *
 * @version 1.0.0<br/>
 */
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.TextView;

import shuashuami.hb.com.hbclient.R;

public class AndroidAnimationActivity extends Activity {

    private Animation myAnimation_Translate;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test_main);

        final TextView tv = (TextView) findViewById(R.id.test_tv);
        Button btn = (Button) findViewById(R.id.test_btn);

        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv.setVisibility(View.VISIBLE);
                myAnimation_Translate = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.RELATIVE_TO_SELF, -1,
                        Animation.RELATIVE_TO_SELF, 0);
                myAnimation_Translate.setDuration(500);
                myAnimation_Translate.setInterpolator(AnimationUtils
                        .loadInterpolator(AndroidAnimationActivity.this,
                                android.R.anim.accelerate_decelerate_interpolator));
                tv.startAnimation(myAnimation_Translate);
            }
        });
    }
}
